<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>我的简历 - ShakesBeare</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Hosting Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>

    <link href="${pageContext.request.contextPath}/static/home/css/bootstrap.css" rel='stylesheet' type='text/css' />

    <script src="${pageContext.request.contextPath}/static/home/js/jquery-1.11.1.min.js"></script>

    <link href="${pageContext.request.contextPath}/static/home/css/style.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/home/css/resume_manage.css" rel='stylesheet' type='text/css' />

    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/js/vendor/chosen/css/chosen.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/js/vendor/chosen/css/chosen-bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/js/vendor/datatables/css/dataTables.bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/js/vendor/datatables/css/ColVis.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/js/vendor/datatables/css/TableTools.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/js/vendor/videobackground/css/jquery.videobackground.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/assets/css/vendor/bootstrap/bootstrap.min.css" type="text/css"/>
    <link href='${pageContext.request.contextPath}/static/home/css/font-awesome.css' rel='stylesheet' type='text/css'/>
    <!-- dropdown -->

    <link href="${pageContext.request.contextPath}/static/home/css/nav.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${pageContext.request.contextPath}/static/admin/css/sweetalert.css" rel="stylesheet">

    <!-- start-smoth-scrolling -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/move-top.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/easing.js"></script>

    <script src="${pageContext.request.contextPath}/static/admin/js/page.js"></script>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery.easydropdown.js"></script>
    <script src="${pageContext.request.contextPath}/static/admin/js/sweetalert.min.js"></script>
    <!-- start-smoth-scrolling -->
    <!-- webfonts -->
    <%--<link href='http://fonts.useso.com/css?family=Ubuntu:300,400,500,700' rel='stylesheet' type='text/css'>--%>
    <!-- webfonts -->
    <!-- start-smoth-scrolling -->
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <!-- end-smoth-scrolling -->
</head>
<!-- Header Starts Here -->
<div class="banner inner-banner" >
    <%@include file="../header.jsp"%>

    <div id="breadcrumb_wrapper">
        <div class="container">

            <h3>我的简历</h3>
            <h6>看看自己的简历吧！</h6>

            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="clearfix"> </div>
<!-- Header Ends Here -->
<!--Main Starts Here-->
<div class="container">
    <div class="support support2">
        <div class="row">
            <div class="col-md-10" style="position: relative; top: 20px;">
                <h2>创建一份新的简历吧！</h2>
            </div>
            <div class="col-md-2">
                <p><a class="read-more" href="${pageContext.request.contextPath}/home/resume/create.action">创建</a></p>
            </div>
        </div>
    </div>

    <div class="tile-body color transparent-black rounded-corners tab-pane fade in active " id="home">

        <div class="table-responsive">
            <table  class="table table-datatable table-custom basicDataTable">
                <thead>
                <tr>
                    <th class="no-sort">简历编号</th>
                    <th class="no-sort">应聘工作</th>
                    <th class="sort-amount">学历</th>
                    <th class="sort-amount">薪资</th>
                    <th class="sort-numeric">创建时间</th>
                    <th class="no-sort">操作</th>
                </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
        </div>

    </div>

    <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
        <div class="row">

            <%--<div class="col-sm-4">--%>
                <%--<button type="button" class="btn btn-default btn-xs margin-bottom-20" onclick="delete_confirm()">删除</button>--%>
            <%--</div>--%>

            <div class="col-sm-offset-4 col-sm-4 text-center">
                <small class="inline table-options paging-info"></small>
            </div>

            <div class="col-sm-4 text-right sm-center">
                <ul class="pagination pagination-xs nomargin pagination-custom">

                </ul>
            </div>

        </div>
    </div>

    <p><br><br></p>
</div>

<!--Main Ends Here-->

<table id="table_td_temp" style="display:none">
    <tbody id="template-list-tbody">
    <tr>
        <td>Jacob</td>
        <td>Thornton</td>
        <td>@fat</td>
        <td>@fat</td>
        <td>@fat</td>
        <td>
            <a class="check-toggler delete_resume">删除&nbsp;</a>
            <a href="" class="resume_detail">查看详情&nbsp;</a>
        </td>
    </tr>
    </tbody>
</table>

<!-- #Footer -->
<%@include file="../footer.jsp"%>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">

    var show = "";
    var fetchData = function (furl) {
        if(furl==null) {
            url = "${pageContext.request.contextPath}/home/resume/getResumeList.action?p=1";
        }else{
            url = furl;
        }
        $.ajax({
            type:'get',
            url:url,
            success:function(json){
                console.log(json);
                show = json.show;
                if (show=="" ||show.totalRows == 0) {
                    $(".container table tbody").html('<tr><td colspan="10" align="center">暂无记录</td></tr>');
                    $('.paging-info').html("showing 0-0 of 0 items");
                    $('.pagination').html("");
                    return;
                } else {
                    var string = "";
                    var list = json.data;
                    var body = $(".container table tbody");
                    var temp_body = $('#template-list-tbody');
                    var tds = $('#table_td_temp td');
                    for (var i in list) {
                        $('#table_td_temp .resume_detail').attr("href","${pageContext.request.contextPath}/home/resume/detail.action?resume_id="+list[i].resume_id);
                        $("#table_td_temp .delete_resume").attr("href","javascript:delete_confirm("+list[i].resume_id+")");
                        tds[0].innerHTML = list[i].serial_num;
                        tds[1].innerHTML = list[i].expect_job;
                        tds[2].innerHTML = list[i].degree.degree_name;
                        tds[3].innerHTML = list[i].salary_type.value;
                        tds[4].innerHTML = list[i].date_added_string;
                        string += temp_body.html();
                    }
                    body.html(string);
                    console.log(show);
                    if(show.currentPage == show.totalPage){
                        $('.paging-info').html("showing "+(show.startIndex+1)+"-"+show.totalRows+" of "+show.totalRows+" items");
                    }else {
                        $('.paging-info').html("showing "+(show.startIndex+1)+"-"+show.endIndex+" of "+show.totalRows+" items");
                    }
                    make_page(show,'.pagination','?');
                }
            }
        });
    };
    fetchData();


    $(document).ready(function() {
        /*
         var defaults = {
         containerID: 'toTop', // fading element id
         containerHoverID: 'toTopHover', // fading element hover id
         scrollSpeed: 1200,
         easingType: 'linear'
         };
         */

        $().UItoTop({ easingType: 'easeOutQuart' });

    });

    function delete_confirm(id){
        var ids = new Array();
        if(id==null) {
            var selected = $('#table_customer tbody input:checkbox:checked');
            if(selected.length == 0){
                swal("", "请选择要删除的简历！", "error");
                return;
            }
            for (var i = 0; i < selected.length; i++) {
                ids[i] = selected[i].value;
            }
        }else{
            ids[0]=id;
        }
        var ids_arr = {"ids":ids};
        swal({
            title: "",
            text: "确认删除？",
            type: "warning",
            showCancelButton: true,
            closeOnConfirm: true,
            confirmButtonText: "确定",
            confirmButtonColor: "#ec6c62"
        }, function() {
            deleteResumes(ids_arr);
        });
    }

    function deleteResumes(ids){

        $.ajax({
            url:"${pageContext.request.contextPath}/home/resume/deleteResumes.action",
            type:'post',
            contentType:'application/json;charset=utf-8',
            data:JSON.stringify(ids),
            success:function(json){
                if(json != 1){
                    swal("", "删除错误！", "error");
                }else{
                    swal("", "删除成功！", "success");
                }
                if(show.totalRows!=0) {
                    fetchData("${pageContext.request.contextPath}/home/resume/getResumeList.action?p="+show.currentPage);
                }
                if($('table thead input[type="checkbox"]').prop('checked')){
                    $('table thead input[type="checkbox"]').prop('checked', false);
                }
            }
        });
    }

</script>

<!-- //here ends scrolling icon -->
</body>
</html>
